using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SimpleJson;

namespace Dolls
{
    /// <summary>
    /// 子弹类型
    /// </summary>
    public enum eBullet
    {
        Null,
        Missile,    //火箭弹
        SpiderMine, //蜘蛛雷
        Common, //普通速射弹
        EBullet, //电磁弹
        Cannonball, //重炮炮弹
        Laser,   //激光
    }


    /// <summary>
    /// 弹药类型
    /// </summary>
    public class CBullet
    {
        public int index;
        public string name;
        public string nameE;
        public string des;
        public string desE;
        public eBullet type;
        public string icon;
        public string modleAssetIndex;
    }


    public class CBulletManager : cDataBase<CBullet, CBulletManager>
    {
        protected override string GetPath()
        {
            return "Assets/project/res/bullet.json";
        }

        protected override void ReadData(JsonArray array)
        {
            foreach (JsonObject item in array)
            {
                CBullet info = new()
                {
                    index = Convert.ToInt32(item["index"]),
                    name = Convert.ToString(item["name"]),
                    nameE = Convert.ToString(item["nameE"]),
                    des = Convert.ToString(item["des"]),
                    desE = Convert.ToString(item["desE"]),
                    type = Enum.Parse< eBullet >( Convert.ToString(item["type"])),
                    icon = Convert.ToString(item["icon"]),
                    modleAssetIndex = Convert.ToString(item["modleAssetIndex"]),
                    
                };
                mDict.Add(info.index, info);
            }
            gameUtility.Log("read bullet.json ok");
        }
    }


}

